<?
	$title="Edit Profiles";
	
	require("required/dbconnect.php"); 
	require("required/function.php"); 
	 
	$id=$_POST['id'];
	$sub_first_name=$_POST['sub_first_name'];
	$sub_last_name=$_POST['sub_last_name'];
	$sub_email=$_POST['sub_email'];
	$current_email=$_POST['current_email'];
	$status=$_POST['status'];
	
	$chk=mysql_query("select count(*) as result from os_email_subscriber where sub_email='$sub_email' and sub_email<>'$current_email'");
	
	if(mysql_result($chk,0,"result")==0)
	{			
		$query="update os_email_subscriber set sub_first_name='$sub_first_name',sub_last_name='$sub_last_name',sub_email='$sub_email',status='$status' where id=$id";
		
		$update=mysql_query($query)or die(mysql_error());
		header("Location:subscriber_edit.php?action=3&id=$id");
	}
	else
	{
		header("Location:subscriber_edit.php?id=$id&action=1");
	}
?>
			
			